<template>
  <div>
    <h3>Left组件</h3>
    <p>这是left组件</p>
    <h2>{{age}}</h2>
    <input type="text" v-if="flag" @blur="flag = false" ref="ipt" />
    <button v-else @click="showipt">按钮</button>
  </div>
</template>

<script>
export default{
  data () {
    return {
      flag:true,
      age:20
    }
  },
  methods:{
    showipt(){
      this.age++
      this.age++
      this.age++
      this.age++
      this.flag = true

      this.$nextTick(()=>{
        this.$refs.ipt.focus()
      })
    }
  }
}
</script>

<style lang="less" scoped>
h3 {
  color:blueviolet;
}
</style>